package com.maiji.cloud.service;

import com.baomidou.mybatisplus.service.IService;
import com.maiji.cloud.entities.shopingmall.CapitalMain;
import com.maiji.cloud.entities.shopingmall.WithdrawalAmountLimitConfigEntity;
import com.maiji.cloud.request.BaseDataReqDto;
import com.maiji.cloud.request.shopingmall.DistributeIntegralReqDto;
import com.maiji.cloud.request.shopingmall.UserBindWinthdrawAccountResData;
import com.maiji.cloud.response.BaseDataResDto;
import com.maiji.cloud.response.BaseResDto;
import com.maiji.cloud.response.shopingmall.CapitalInfoResData;
import com.maiji.cloud.response.shopingmall.CapitalMainResData;
import com.maiji.cloud.response.shopingmall.FinancialDetailsResData;
import com.maiji.cloud.utils.FlowTypeEnum;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Date;
import java.util.List;
import java.util.Map;

public interface CapitalMainService extends IService<CapitalMain> {

	/**
	 * 创建用户资金账户
	 * @param userId
	 * @return
	 */
	Boolean createCapitalMain (@RequestBody String userId);

    /**
     * 修改用户账户资金并记录流水
     * @param userId
     * @param capitalType 1-余额，2-减肥基金，3-积分
     * @param changeQuantity 资金变动数量
     * @param changeType 1-资金增加，2-资金减少
     * @param remark  资金变动备注说明（订单编号等）
     * @param relevantId  关联详情id
     * @return
     */
	Boolean updateCapitalMain(String userId, FlowTypeEnum capitalType, String changeQuantity, FlowTypeEnum changeType,
                              FlowTypeEnum remark, String relevantId);

	/**
	 * 通过remarkInt 分发积分 现用于 社区：发布 点赞 转发 分享
	 * @param distributeIntegralReqDto
	 * @param maijiToken
	 * @return
	 */
	public BaseDataResDto<FinancialDetailsResData> distributeIntegralByRemarkInt(DistributeIntegralReqDto distributeIntegralReqDto, String maijiToken);

	CapitalMainResData calculateCapitalMain(String userId, Double amount, String token);

	/**
	 * 
	 * @param maijiToken
	 * @return
	 */
	BaseDataResDto<CapitalInfoResData> getCapitalInfo(String maijiToken);

	/**
	 * 解冻分销资金
	 * @param orderId
	 * @return
	 */
	Boolean unfreezeDistributionMoney(String orderId);

	/**
	 * 绑定提现账号
	 * @param param
	 * @param maijiToken
	 * @return
	 */
	BaseResDto userBindWinthdrawAccount(BaseDataReqDto<UserBindWinthdrawAccountResData> param, String maijiToken);

    List<CapitalMain> findAllCapitalMains(List<String> userIds);

    BaseDataResDto<Map<String, Object>> findCapitalMainCount();

    /**
     * 配置提现金额
     * @param withdrawalAmountLimitConfig
     * @return
     */
	BaseResDto editWithdrawalAmountLimitConfig(WithdrawalAmountLimitConfigEntity withdrawalAmountLimitConfig);

    BaseDataResDto<WithdrawalAmountLimitConfigEntity> findWithdrawalAmountLimitConfig(Integer type);

    BaseDataResDto<List<WithdrawalAmountLimitConfigEntity>> findAllWithdrawalAmountLimitConfigLogs(List<Date> updateDates);
}
